package com.bwie.goods.controller;

import com.bwie.common.domain.PurchaseRecord;
import com.bwie.common.domain.request.PurchaseRecordRequest;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
import com.bwie.goods.service.PurchaseRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/PurchaseRecord")
public class PurchaseRecordController {
    @Autowired
    PurchaseRecordService purchaseRecordService;

    /**
     * 买车记录列表
     * @param purchaseRecordRequest
     * @return
     */
    @PostMapping("/list")
    public Result<PageResult<PurchaseRecord>> list(@RequestBody PurchaseRecordRequest purchaseRecordRequest){
        Result<PageResult<PurchaseRecord>> list=purchaseRecordService.list(purchaseRecordRequest);
        return list;
    }

    /**
     * 编辑通过id回显
     * @param id
     * @return
     */
    @PostMapping("/findById/{id}")
    public Result findById(@PathVariable Integer id){
        Result result=purchaseRecordService.findById(id);
        return result;
    }
}
